home *** CD-ROM | disk | FTP | other *** search
/ Champak 52 / Volume 52 - JOGO DISK .iso / Games / skipandgouls.swf / scripts / __Packages / characters / VampiRay.as < prev   
Text File  |  2007-10-01  |  1KB  |  37 lines

  1. class characters.VampiRay extends sarbakan.visual.element.DynamicElement
  2. {
  3.    static var ATTACK_DELAY = 200;
  4.    var nAttackDelayCount = 0;
  5.    function VampiRay(l_oLayer, l_oInfos)
  6.    {
  7.       super("vampiRay" + sarbakan.visual.element.BaseElement.getNextID());
  8.       var _loc3_ = l_oLayer.mc;
  9.       this.mc = _loc3_.attachMovie("vampiRay","vampiRay" + sarbakan.visual.element.BaseElement.nNextID,maze.MazeData.DEPTH_VAMPIRAY + sarbakan.visual.element.BaseElement.nNextID);
  10.       this.mc._x = l_oInfos.x * maze.MazeData.VIEW_TILE_WIDTH;
  11.       this.mc._y = l_oInfos.y * maze.MazeData.VIEW_TILE_HEIGHT;
  12.       this.disable();
  13.       this.updateState();
  14.    }
  15.    function idle()
  16.    {
  17.       if(this.nAttackDelayCount < characters.VampiRay.ATTACK_DELAY)
  18.       {
  19.          this.nAttackDelayCount = this.nAttackDelayCount + 1;
  20.       }
  21.       else if(this.oOwner.oDynamicElements.spongebob.bCanBeScared && this.collideWithElementBox("spongebob",this.mc.collider))
  22.       {
  23.          this.oOwner.oDynamicElements.spongebob.onScared();
  24.          this.nAttackDelayCount = 0;
  25.          this.setState("attack");
  26.          sarbakan.sound.SoundManager.play("vampiraySound",maze.MazeData.VOLUME_VAMPIRAY,1,false);
  27.       }
  28.    }
  29.    function attack()
  30.    {
  31.       if(this.stateFinished())
  32.       {
  33.          this.setState("idle");
  34.       }
  35.    }
  36. }
  37.